/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.google.common.collect.Lists;

/**
 *  方案产品步骤Entity
 * @author liujiang
 * @version 2013-08-19
 */
@Entity
@Table(name = "solution_face_product_step")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SolutionFaceProductStep extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private SolutionFace solutionFace; 		// 解决方案
	private int step; 	// 家居保养步骤1 - 15之间的正整数

	private List<SolutionFaceProductMix>  mixList = Lists.newArrayList();
	
	public SolutionFaceProductStep() {
	}

	public SolutionFaceProductStep(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH},fetch = FetchType.LAZY)
	@JoinColumn(name="solution_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public SolutionFace getSolutionFace() {
		return solutionFace;
	}

	public void setSolutionFace(SolutionFace solutionFace) {
		this.solutionFace = solutionFace;
	}

	public int getStep() {
		return step;
	}

	public void setStep(int step) {
		this.step = step;
	}
	
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy="solutionFaceProductStep")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<SolutionFaceProductMix> getMixList() {
		return mixList;
	}

	public void setMixList(List<SolutionFaceProductMix> mixList) {
		this.mixList = mixList;
	}
}